import React, { Component } from 'react'

export default class App extends Component {
  state = {
    firstName: '',
    lastName: ''
  }
  handler = (event) => {
    this.setState({
      lastName: event.target.value
    })
  }
  render() {
    return (
      <div>
        <input onChange = { (event) => {
          console.log(event.target.value)
          this.setState({
            firstName: event.target.value
          })
        }} type="text" placeholder="姓"/> + 
        <input onChange = { this.handler } type="text" placeholder="名"/> = 
        {
          this.state.firstName + ' ' + this.state.lastName
        }
      </div>
    )
  }
}
